import tensorflow as tf

# 检查是否有可用的GPU设备
gpus = tf.config.list_physical_devices('GPU')
if gpus:
    print("CUDA is available.")
    for gpu in gpus:
        print(f"GPU: {gpu}")
else:
    print("CUDA is not available.")
